home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq21.zip / PUTLINE.SLT < prev    next >
Text File  |  1992-03-20  |  2KB  |  68 lines

  1. //-----------------------------------------------------------
  2. // PutLine.SL?  Output line to BBS without generating errors.
  3. //-----------------------------------------------------------
  4.  
  5. // If you have suggestions for improving this script, please suggest
  6. // improvements to me via old-fashioned snail-mail to:
  7.  
  8. // Author:  Inge Vabekk
  9. //          Hamangskogen 108
  10. //          N-1300 SANDVIKA
  11. //          NORWAY
  12. //          tel. (472) 546 396
  13.  
  14.  
  15. //-----------------------------------------------------------
  16. // PutLine script is entered here.
  17. //-----------------------------------------------------------
  18.  
  19. main (str text, int CR)
  20. {
  21. int i, j, k, l, w, save;
  22. str check [80];
  23.  
  24.   if (!carrier()) return (-1);
  25.   save = _scr_chk_key;                 // Save ESC option.
  26.   _scr_chk_key = 1;
  27.   l = get_baud();
  28.   if (l > 9600) l = 9600;
  29.   w = 19200/l;
  30.   l = strlen (text);                   // Get length of text.
  31.   if (subchr (text,l-1)==CR)           // Terminated by CR?
  32.     setchr (text,--l,0);               // Yes, delete it.
  33.  
  34.   for (i=0; i<3; ++i)
  35.     cputc (8);                         // Remove possible line noise.
  36.  
  37.   for (i=0; i<3; ++i)                  // Three attempts.
  38.   { cputs (text);                      // Write text.
  39.     if (l < 3) goto OK;                // If < 3 chars, skip checks.
  40.     for (j=0; j<10; ++j)
  41.     { do 
  42.       { terminal();                    // Process all echo
  43.         k = getx()-l-3;                // Get position.
  44.         if (k<0) k=0;
  45.         vgetchrs(k,gety(),check,0,80); // Get line from screen.
  46.  
  47.         if (strposi (check,text,0) >= 0)// Compare.
  48.           goto OK;
  49.         delay(w);                      // Wait a little, then continue.
  50.       } while (cinp_cnt() > 0);
  51.     }
  52.     for (j=-3; j<l; ++j)
  53.       cputc (8);                       // Delete erroneous entry
  54.   }                                    // and try again.
  55.   prints ("");
  56.   prints ("T²: Attempts failed.");
  57.   printsc ("Check = ");
  58.   prints (check);
  59.   printsc ("Text  = ");
  60.   prints (text);
  61.  
  62.   cputs (text);                        // Error: One last try.
  63. OK:
  64.   if (CR) cputc (CR);                  // Send CR if wanted.
  65.   _scr_chk_key = save;                 // Restore ESC option.
  66. }
  67.  
  68.